#include "clickablelabel.h"
#include<QEvent>
ClickableLabel::ClickableLabel(QWidget* parent)
:QLabel(parent){
    setupStyle();
}
void ClickableLabel::setupStyle(){
    // 设置手型光标，表示可点击
    setCursor(Qt::PointingHandCursor);

    // 简单的悬停效果
    setStyleSheet(
        "SimpleClickableLabel {"
        "    padding: 2px;"
        "    border: 1px solid transparent;"
        "    border-radius: 2px;"
        "}"
        "SimpleClickableLabel:hover {"
        "    background-color: #e6f3ff;"
        "    border: 1px solid #cce0ff;"
        "}"
        );
}

void ClickableLabel::mousePressEvent(QMouseEvent* event){
    if(event->button()==Qt::LeftButton){
        emit clicked();
    }
    QLabel::mousePressEvent(event);
}
void ClickableLabel::leaveEvent(QEvent *event){
    QLabel::leaveEvent(event);
}

void ClickableLabel::enterEvent(QEnterEvent* event){
    QLabel::enterEvent(event);
}
